/**
 * Copyright 2013-2015
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */	  

package com.cos.service.admin.company;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cos.dao.DaoSupport;
import com.cos.util.PageData;
import com.cos.util.StringUtil;

/**
 * TODO 类或接口说明
 * <p/>
 * 
 * @author <a href="15083378620@163.com">LXJ</a>
 * @version  Date: 2016年5月13日 上午11:30:17
 * @serial 1.0
 * @since 2016年5月13日 上午11:30:17
 */
@Service("companyManagementService")
public class CompanyManagementService {
	
	
	@Resource(name = "daoSupport")
	private DaoSupport dao;
	
	/**
	 * 将PageData里的ID组装成字符串
	 * @return
	 */
	public String[] groupIDs(List<PageData> pd) {
		String str = "" ;
		for(PageData pageData :pd) {
			str += pageData.getString("U_ID") +","; 
		}
		str = str.substring(0,str.length()-1) ;
		return StringUtil.StrList(str);
	}
	
	
	/*
	* 公司员工展示
	*/
	@SuppressWarnings("unchecked")
	public List<PageData> selectAllU(String[] USER_IDS)throws Exception{
		return (List<PageData>)dao.findForList("CompanyManagementMapper.selectAllU", USER_IDS);
	}
	
	/*
	* 查询出该公司所有用户的U_ID
	*/
	@SuppressWarnings("unchecked")
	public List<PageData> SelectU_ID(String C_ID)throws Exception{
		return (List<PageData>) dao.findForList("CompanyManagementMapper.SelectU_ID", C_ID);
	}
	
	/*
	* 查询出该公司所有用户的U_ID
	*/
	@SuppressWarnings("unchecked")
	public List<PageData> selectCompanyDepartment(String C_ID)throws Exception{
		return (List<PageData>) dao.findForList("CompanyManagementMapper.selectCompanyDepartment", C_ID);
	}
}
